package com.doget.data.base;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.util.List;

/**
 * 作者：created by admin on 2019-09-19 09:56
 * 邮箱：910663958@qq.com
 */
public class DynamicUrlBean {

    /**
     * state : true
     * value : [{"id":39,"title":"兑吧首页链接","picSrc":"","code":"duiba_home_link","picType":3,"creationDate":1568803459000,"updationDate":1568803459000,"enabledFlag":1,"sort":1,"page":"https://smbank.shimaogroup.com/smees/duibaRedirectLogin?mobile={mobile}&name={name}&dbredirect="},{"id":40,"title":"首页精选商品图片链接","code":"duiba_jingxuan_header","picType":3,"creationDate":1568810380000,"updationDate":1568810380000,"enabledFlag":1,"sort":3,"page":"https://smbank.shimaogroup.com/smees/duibaRedirectLogin?mobile={mobile}&name={name}&dbredirect="},{"id":41,"title":"签到按钮链接","code":"duiba_qiandao_link","picType":3,"creationDate":1568810453000,"updationDate":1568810453000,"enabledFlag":1,"sort":3,"page":"https://smbank.shimaogroup.com/smees/duibaRedirectLogin?mobile={mobile}&name={name}&dbredirect=https%3A%2F%2F64705.activity-1.m.duiba.com.cn%2Fsign%2Ffornew%2Findex%3Fid%3D170"},{"id":42,"title":"世茂金融","code":"jinrong_link","picType":3,"creationDate":1568810647000,"updationDate":1568810647000,"enabledFlag":1,"sort":3,"page":"https://cms.huanrunloan.com/webUser/shimaoGroupLogin?mobile={mobile}&timeStamp={timestamp}&userSign={userSign}&mobileLogin={mobileLogin}"},{"id":44,"title":"光核教育","code":"guanghe_link","picType":3,"creationDate":1568810762000,"updationDate":1568810762000,"enabledFlag":1,"sort":3,"page":"https://mp.weixin.qq.com/s/1hjpuyH-GOgW2SOvcMJ72g"},{"id":45,"title":"世茂酒店图片链接","code":"shimao_hotel_img","picType":3,"creationDate":1568810834000,"updationDate":1568810834000,"enabledFlag":1,"sort":3,"page":"https://smcloud.shimaowy.com/miniprogram/img/sm_hotel.jpg"},{"id":43,"title":"健康管理","code":"jiankang_link","picType":3,"creationDate":1568810688000,"updationDate":1568810688000,"enabledFlag":1,"sort":4},{"id":46,"title":"兑吧统一登录链接","code":"duiba_login_link","picType":3,"creationDate":1568810882000,"updationDate":1568810882000,"enabledFlag":1,"sort":4,"page":"https://smbank.shimaogroup.com/smees/duibaRedirectLogin?mobile={mobile}&name={name}&dbredirect="},{"id":48,"title":"APP分享小程序时的环境参数","code":"miniprogram_Type","picType":3,"creationDate":1568811003000,"updationDate":1568811003000,"enabledFlag":1,"sort":7,"page":"2","content":"指定分享小程序版本(0 正式版，1 测试版，2 体验版)"}]
     */

    private boolean state;
    private List<ValueBean> value;

    public boolean isState() {
        return state;
    }

    public void setState(boolean state) {
        this.state = state;
    }

    public List<ValueBean> getValue() {
        return value;
    }

    public void setValue(List<ValueBean> value) {
        this.value = value;
    }

    public static class ValueBean {
        @Override
        public String toString() {
            return "ValueBean{" +
                    "id=" + id +
                    ", title='" + title + '\'' +
                    ", picSrc='" + picSrc + '\'' +
                    ", code='" + code + '\'' +
                    ", picType=" + picType +
                    ", creationDate=" + creationDate +
                    ", updationDate=" + updationDate +
                    ", enabledFlag=" + enabledFlag +
                    ", sort=" + sort +
                    ", page='" + page + '\'' +
                    ", content='" + content + '\'' +
                    '}';
        }

        /**
         * id : 39
         * title : 兑吧首页链接
         * picSrc :
         * code : duiba_home_link
         * picType : 3
         * creationDate : 1568803459000
         * updationDate : 1568803459000
         * enabledFlag : 1
         * sort : 1
         * page : https://smbank.shimaogroup.com/smees/duibaRedirectLogin?mobile={mobile}&name={name}&dbredirect=
         * content : 指定分享小程序版本(0 正式版，1 测试版，2 体验版)
         */

        private int id;
        private String title;
        private String picSrc;
        private String code;
        private int picType;
        private long creationDate;
        private long updationDate;
        private int enabledFlag;
        private int sort;
        private String page;
        private String content;

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getPicSrc() {
            return picSrc;
        }

        public void setPicSrc(String picSrc) {
            this.picSrc = picSrc;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public int getPicType() {
            return picType;
        }

        public void setPicType(int picType) {
            this.picType = picType;
        }

        public long getCreationDate() {
            return creationDate;
        }

        public void setCreationDate(long creationDate) {
            this.creationDate = creationDate;
        }

        public long getUpdationDate() {
            return updationDate;
        }

        public void setUpdationDate(long updationDate) {
            this.updationDate = updationDate;
        }

        public int getEnabledFlag() {
            return enabledFlag;
        }

        public void setEnabledFlag(int enabledFlag) {
            this.enabledFlag = enabledFlag;
        }

        public int getSort() {
            return sort;
        }

        public void setSort(int sort) {
            this.sort = sort;
        }

        public String getPage() {
            return page;
        }

        public void setPage(String page) {
            this.page = page;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public BannerItemPathInfo getItemPathInfo(){

            if(this.picSrc != null && this.picSrc.length() > 0){
                Gson mJson = new Gson();

                List<BannerItemPathInfo> info = mJson.fromJson(this.picSrc, new TypeToken<List<BannerItemPathInfo>>() {
                }.getType());
                if(info != null && info.size() > 0){
                    return info.get(0);
                }
                return new BannerItemPathInfo();
            }
            return new BannerItemPathInfo();
        }
    }

    public static class BannerItemPathInfo{
        private String id;
        private String name;
        private int size;
        private String path;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getSize() {
            return size;
        }

        public void setSize(int size) {
            this.size = size;
        }

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }
    }
}
